package com.zzyl.nursing.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zzyl.common.core.controller.BaseController;
import com.zzyl.common.core.page.TableDataInfo;
import com.zzyl.nursing.domain.DeviceData;
import com.zzyl.nursing.dto.DeviceDataPageReqDto;
import com.zzyl.nursing.service.IDeviceDataService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 设备数据Controller
 * 
 * @author zzyl
 * @date 2025-10-25
 */
@RestController
@RequestMapping("/nursing/data")
@Api(tags = "设备数据相关接口")
public class DeviceDataController extends BaseController
{
    @Autowired
    private IDeviceDataService deviceDataService;

    /**
     * 查询设备数据列表
     */
    @PreAuthorize("@ss.hasPermi('nursing:deviceData:list')")
    @GetMapping("/list")
    @ApiOperation(value = "获取设备数据列表")
    public TableDataInfo<List<DeviceData>> pageList(DeviceDataPageReqDto dto)
    {
        Page<DeviceData> deviceDataPage = deviceDataService.pageList(dto);

        TableDataInfo tableDataInfo = getDataTable(deviceDataPage.getRecords());
        tableDataInfo.setTotal(deviceDataPage.getTotal());

        return tableDataInfo;
    }

//    /**
//     * 导出设备数据列表
//     */
//    @PreAuthorize("@ss.hasPermi('nursing:deviceData:export')")
//    @Log(title = "设备数据", businessType = BusinessType.EXPORT)
//    @PostMapping("/export")
//    @ApiOperation("导出设备数据列表")
//    public void export(HttpServletResponse response, DeviceData deviceData)
//    {
//        List<DeviceData> list = deviceDataService.selectDeviceDataList(deviceData);
//        ExcelUtil<DeviceData> util = new ExcelUtil<DeviceData>(DeviceData.class);
//        util.exportExcel(response, list, "设备数据数据");
//    }
//
//    /**
//     * 获取设备数据详细信息
//     */
//    @PreAuthorize("@ss.hasPermi('nursing:deviceData:query')")
//    @GetMapping(value = "/{id}")
//    @ApiOperation("获取设备数据详细信息")
//    public R<DeviceData> getInfo(@ApiParam(value = "设备数据ID", required = true)
//            @PathVariable("id") Long id)
//    {
//        return R.ok(deviceDataService.selectDeviceDataById(id));
//    }
//
//    /**
//     * 新增设备数据
//     */
//    @PreAuthorize("@ss.hasPermi('nursing:deviceData:add')")
//    @Log(title = "设备数据", businessType = BusinessType.INSERT)
//    @PostMapping
//    @ApiOperation("新增设备数据")
//    public AjaxResult add(@ApiParam(value = "设备数据实体", required = true) @RequestBody DeviceData deviceData)
//    {
//        return toAjax(deviceDataService.insertDeviceData(deviceData));
//    }
//
//    /**
//     * 修改设备数据
//     */
//    @PreAuthorize("@ss.hasPermi('nursing:deviceData:edit')")
//    @Log(title = "设备数据", businessType = BusinessType.UPDATE)
//    @PutMapping
//    @ApiOperation("修改设备数据")
//    public AjaxResult edit(@ApiParam(value = "设备数据实体", required = true) @RequestBody DeviceData deviceData)
//    {
//        return toAjax(deviceDataService.updateDeviceData(deviceData));
//    }
//
//    /**
//     * 删除设备数据
//     */
//    @PreAuthorize("@ss.hasPermi('nursing:deviceData:remove')")
//    @Log(title = "设备数据", businessType = BusinessType.DELETE)
//	@DeleteMapping("/{ids}")
//    @ApiOperation("删除设备数据")
//    public AjaxResult remove(@ApiParam(value = "要删除的数据id的数组") @PathVariable Long[] ids)
//    {
//        return toAjax(deviceDataService.deleteDeviceDataByIds(ids));
//    }
}
